''' Mission 8 -- Answer Bot Solution with traversing a list ''' from codex import * import random from time import sleep answers = ["The odds are yes", "It is not in the stars", "Go for the gold!", "Today is your day", "Stay home and read", "Have an adventure"] # === Functions def pixel_colors(delay): pixels.set(0, random.choice(COLOR_LIST)) pixels.set(1, random.choice(COLOR_LIST)) pixels.set(2, random.choice(COLOR_LIST)) pixels.set(3, random.choice(COLOR_LIST)) sleep(delay) def slideshow(): for item in answers: display.print(item) sleep(1) # === Main Program while True: delay = random.randrange(1, 10)/10 pixel_colors(delay) if buttons.was_pressed(BTN_A): display.clear() display.print(random.choice(answers)) if buttons.was_pressed(BTN_U): slideshow() if buttons.was_pressed(BTN_B): break # === end display.clear() pixels.off()